import java.util.Scanner;

public class Selflearn_8_guessnumber {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int target=(int) (Math.random()*100+1);
//        target=50;
        int guess,count=0;
        System.out.println("欢迎来到猜数游戏，系统会自动生成1~100的整数，你要尽可能用更少的次数猜出这个数字");
        do{
            guess=in.nextInt();
            count++;
            if(guess>target){
                System.out.println("大了");
            }
            if(guess<target){
                System.out.println("小了");
            }
        }while(guess!=target);
        System.out.print("恭喜你猜对了，你一共用了"+count+"次。");
        if (count==1){
            System.out.println("难以置信你第一次就蒙对了……");
        }
    }
}
